<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/15
 * Time: 16:23
 */

namespace app\index\controller;


use app\common\controller\WebBase;
use think\Db;                       // db
use app\common\model\Photo as PhotoModel;
use app\common\model\Nav as NavModel;
use app\common\model\Advimage as AdvimageModel;
use app\common\model\Slide as SlideModel;
use app\common\model\Article as ArticleModel;


class User extends WebBase
{
    private $_photo_model;
    private $_nav_model;
    private $_advimage_model;
    private $_slide_model;
    private $_article_model;

    protected function _initialize(){
        if(is_mobile()){
//            $this->success('手机访问','Index/index');
            $this->redirect('Phone/index/index');
        }
        $this->_article_model = new ArticleModel();
        $this->_advimage_model = new AdvimageModel();
        $this->_photo_model = new PhotoModel();
        $this->_nav_model = new NavModel();
        $this->_slide_model = new SlideModel();
        $nav = $this->_nav_model->name('nav')->select();
        $leftadv = $this->_advimage_model->where("cid = 2 and status = 0")->order("sort desc")->select();
        $rightadv = $this->_advimage_model->where("cid = 1 and status = 0")->order("sort desc")->select();
        $this->assign('rightadv',$rightadv);
        $this->assign('leftadv',$leftadv);
        $this->assign('nav',$nav);
    }

    function index(){
        return $this->fetch();
    }
}